package com.dfbz.demo07_反射与泛型;

import java.lang.reflect.Field;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01_有限制擦除 {
    public static void main(String[] args) {

        // 1. 获取字节码对象
        Class<Example> exampleClass = Example.class;

        // 2. 获取这个类所有的字段
        Field[] fields = exampleClass.getDeclaredFields();
        for (Field field : fields) {
            System.out.println(field);
        }

        System.out.println("--------------");

        Class<A> aClass = A.class;

        // 2. 获取这个类所有的字段
        Field[] aFields = aClass.getDeclaredFields();
        for (Field field : aFields) {
            System.out.println(field);
        }

        System.out.println("--------------");
    }
}

class A{
    private String param;

    public String getParam() {
        return param;
    }

    public void setParam(String param) {
        this.param = param;
    }

}
class Example<T extends Number> {

    private T param;

    public T getParam() {
        return param;
    }

    public void setParam(T param) {
        this.param = param;
    }
}
